import { http } from '@/utils/http'
import { NewsData } from '@/service/news/news'

export interface Department {
  deptId: number
  deptName: string
  englishDeptName: string
  deptCode: string
  parentId: number
  isStore: number
  isDept: boolean
  isActive: boolean
}

export interface DepartmentResponse {
  code: number
  data: Department[]
  message: string
  serviceTime: string
}

/* 获取 父级菜单-用于课程、知识驿站等 */
export const getParentDepartment = (): Promise<IResData<Department[]>> => {
  return http.get<Department[]>('/api/MP/GetParentDeptList')
}

/* 获取 二级菜单-用于课程、知识驿站等 */
/*
 * @param ParentDeptId 父级菜单ID(deptId)
 */
export const getSecondDepartment = (ParentDeptId: number): Promise<IResData<Department[]>> => {
  return http.get<Department[]>('/api/MP/GetDeptList', { ParentDeptId })
}
